package com.poker.service;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

@Service
public class RedisService {

    @Resource
    private RedisTemplate<String, String> template;

    public void setMinCache(String key, String value, Integer time) {
        template.opsForValue().set(key, value, time, TimeUnit.MINUTES);
    }

    public String getValueFromCache(String key) {
        return template.opsForValue().get(key);
    }

}
